# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=regeorg
pkgver=30.1ca54c2
pkgrel=4
groups=('blackarch' 'blackarch-tunnel' 'blackarch-proxy')
pkgdesc='The successor to reDuh, pwn a bastion webserver and create SOCKS proxies through the DMZ. Pivot and pwn.'
arch=('any')
url='https://github.com/sensepost/reGeorg'
license=('custom:Creative Commons')
depends=('python2' 'python2-urllib3' 'python2-httplib2')
makedepends=('git')
source=("$pkgname::git+https://github.com/sensepost/reGeorg.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|/usr/bin/env python|/usr/bin/env python2|' reGeorgSocksProxy.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 reGeorgSocksProxy.py "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE.txt LICENSE.html reGeorgSocksProxy.py

  cp -a * "$pkgdir/usr/share/$pkgname/"
}

